package com.it.whitejotterapi.controller;

import com.it.whitejotterapi.service.SysBookService;
import com.it.whitejotterapi.tools.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 羡羡
 * @Date: 2022/05/23/18:21
 */
@RestController
public class SysBookController {
    @Autowired
    SysBookService sysbookse;

    /**
     * 查询所有的图书
     * @return
     */
    @RequestMapping(path = "/books",method = RequestMethod.GET)
    public JsonResult sebookall(){
        return sysbookse.sysbookall();
    }

    /**
     * 图书分类
     * @param cid 图书ID
     * @return
     */
    @RequestMapping(path = "/books/{cid}",method = RequestMethod.GET)
    public JsonResult secatr(@PathVariable("cid")int cid){
        return sysbookse.sysbookcate(cid);
    }
}
